home *** CD-ROM | disk | FTP | other *** search
- /*
- ** This is the TDoc class declaration. This class is an adaptation of
- ** the class of the same name in the book, Elements of C++ Macintosh
- ** Programming, by Dan Weston.
- **
- ** Copyright © 1991 Mark Gross
- ** (RR2, Box 84, Clayville, NY 13322);
- ** this file may be published everywhere, but no charge
- ** may be made for its use. Please contact me about any bugs found.
- ** I'm also looking for Macintosh development work, so drop me a line
- ** if you think I could help.
- **
- */
-
- #define _H_TDoc
-
-
- struct TDoc:indirect
- {
- OSType fCreator;
- SFReply fFileInfo;
- Boolean fFileOpen;
- short fRefNum;
- WindowPtr fDocWindow;
- Boolean fNeedtoSave;
- Boolean fNeedtoSaveAs;
- /*
- ** Other data holding members will need to be added as needed in
- ** any derived classes from this one.
- */
-
- /* constuctor and destructor */
- TDoc* Init(OSType theCreator, SFReply *SFInfor);
- void Delete(void);
-
- /* initializing documents */
- Boolean MakeWindow(Boolean colorWindow);
- short GetWinID(void);
- Boolean InitDoc(void);
-
- /* maintaining windows */
- WindowPtr GetDocWindow(void);
- void SetDocWindowTitle(Str255 title);
- void MoveDocWindow(short h, short v);
- void ShowDocWindow(void);
-
- /* handling events */
- void DoTheUpdate(EventRecord *TheEvent);
- void Draw(Rect *r);
-
- void DoActivate(EventRecord *TheEvent);
- void Activate(void);
- void Deactivate(void);
-
- void DoGrow(EventRecord *theEvent);
- void DoZoom(short partCode);
- void DoDrag(EventRecord *theEvent);
-
- void DoContent(EventRecord *theEvent);
- void DoKeyDown(EventRecord *theEvent);
-
- void DoIdle(void);
- void AdjustCursor(Point where);
-
- /* handling menus */
- void SetMenuAbility(MenuHandle menu, short item, Boolean enable);
- void AdjustDocMenus(void);
-
- Boolean CanUndo(void);
- Boolean CanSave(void);
- Boolean CanClose(void);
- Boolean CanPaste(OSType);
- Boolean CanSaveAs(void);
- Boolean CanPageSetup(void);
- Boolean CanPrint(void);
- Boolean HaveSelection(void);
- Boolean CanSelectAll(void);
-
- Boolean DoDocMenuCommand(short menuID, short menuItem);
-
- /* cut, copy, and paste */
- Boolean DoCut(Handle *theData, OSType *heType);
- Boolean DoCopy(Handle *theData, OSType *theType);
- void DoPaste(Handle theData, OSType *theType);
- void DoUndo(void);
- void DoClear(void);
- void DoSelectAll(void);
-
- /* handling files */
- short OpenDocFile(SFReply *reply);
- void CloseDocFile(short refNum);
-
- Boolean ReadDocFile(short refNum);
- Boolean WriteDocFile(short refNum);
-
- Boolean DoSaveAs(void);
- Boolean DoSave(void);
- short WantToSave(void);
- Boolean DoClose(void);
-
- OSType GetDocType(void);
-
- void DoPageSetup(void);
- void DoPrint(void);
-
-
-
- void ErrorAlert(short stringsID, short theError);
- };